package com.syys.qa.service.impl;

import java.util.List;

import com.syys.common.utils.DateUtils;
import com.syys.qa.util.IpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.syys.qa.mapper.QaRecordMapper;
import com.syys.qa.domain.QaRecord;
import com.syys.qa.service.IQaRecordService;
import com.syys.common.core.text.Convert;

/**
 * 问卷记录Service业务层处理
 *
 * @author ys
 * @date 2021-07-01
 */
@Service
public class QaRecordServiceImpl implements IQaRecordService {
    @Autowired
    private QaRecordMapper qaRecordMapper;

    /**
     * 查询问卷记录
     *
     * @param recordId 问卷记录ID
     * @return 问卷记录
     */
    @Override
    public QaRecord selectQaRecordById(Long recordId) {
        return qaRecordMapper.selectQaRecordById(recordId);
    }

    /**
     * 查询问卷记录列表
     *
     * @param qaRecord 问卷记录
     * @return 问卷记录
     */
    @Override
    public List<QaRecord> selectQaRecordList(QaRecord qaRecord) {
        return qaRecordMapper.selectQaRecordList(qaRecord);
    }

    /**
     * 新增问卷记录
     *
     * @param qaRecord 问卷记录
     * @return 结果
     */
    @Override
    public int insertQaRecord(QaRecord qaRecord) {
        qaRecord.setCreateTime(DateUtils.getNowDate());
        return qaRecordMapper.insertQaRecord(qaRecord);
    }

    /**
     * 修改问卷记录
     *
     * @param qaRecord 问卷记录
     * @return 结果
     */
    @Override
    public int updateQaRecord(QaRecord qaRecord) {
        qaRecord.setUpdateTime(DateUtils.getNowDate());
        return qaRecordMapper.updateQaRecord(qaRecord);
    }

    /**
     * 删除问卷记录对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteQaRecordByIds(String ids) {
        return qaRecordMapper.deleteQaRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除问卷记录信息
     *
     * @param recordId 问卷记录ID
     * @return 结果
     */
    @Override
    public int deleteQaRecordById(Long recordId) {
        return qaRecordMapper.deleteQaRecordById(recordId);
    }
}
